package com.example.demo.Enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @version 1.0
 * @Author: LJP
 * @Description:        策略demo枚举
 * @Date: Created in 17:11 2022/1/21
 */
@Getter
@AllArgsConstructor
public enum StrategyDemo{

    STRATEGY_ONE(1,"strategyOne"),
    STRATEGY_TWO(2,"strategyTwo");

    /**
     * 策略类型
     */
    private final Integer type;

    /**
     * 具体策略
     */
    private final String StrategyName;


    /**
     * Get strategy string.
     * 通过类型获得具体的策略类型
     * @param type the type
     * @return the string
     */
    public static String getStrategy(String type){
        for (StrategyDemo value : StrategyDemo.values()) {
            if (value.getType().equals(Integer.valueOf(type))){
                return value.getStrategyName();
            }
        }
        return null;
    }

}
